package org.kfive.nova.hadoop;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.kfive.nova.hadoop.mapper.MultiTableJoinMapper;
import org.kfive.nova.hadoop.reducer.MultiTableJoinReducer;

/*
* MultiTableJoin.java
* Created  by  lizhanwu
* Created on 2016/4/20 19:58
*/
public class MultiTableJoin {

    public static void main(String[] args) throws Exception{
        if(args.length!=2){
            System.err.println("WordCount error : Illegal arguments");
            System.exit(-1);
        }

        Job job = new Job();
        job.setJarByClass(MultiTableJoin.class);
        job.setJobName("MultiTableJoin");

        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));

        job.setMapperClass(MultiTableJoinMapper.class);
        job.setReducerClass(MultiTableJoinReducer.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}
